home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 November: Tool Chest / Dev.CD Nov 00 TC Disk 2.toast / pc / sample code / quicktime / basics / mfc simpleplayer.win / simpleplayermfc.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2000-09-28  |  4.0 KB  |  158 lines

  1. // SimplePlayer MFC.cpp : Defines the class behaviors for the application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "SimplePlayerMFC.h"
  6.  
  7. #include "MainFrm.h"
  8. #include "SimplePlayerMFCDoc.h"
  9. #include "SimplePlayerMFCView.h"
  10.  
  11. #include "QTML.h"
  12.  
  13. #ifdef _DEBUG
  14. #define new DEBUG_NEW
  15. #undef THIS_FILE
  16. static char THIS_FILE[] = __FILE__;
  17. #endif
  18.  
  19.  
  20. /////////////////////////////////////////////////////////////////////////////
  21. // CSimplePlayerMFCApp
  22.  
  23. BEGIN_MESSAGE_MAP(CSimplePlayerMFCApp, CWinApp)
  24.     //{{AFX_MSG_MAP(CSimplePlayerMFCApp)
  25.     ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
  26.         // NOTE - the ClassWizard will add and remove mapping macros here.
  27.         //    DO NOT EDIT what you see in these blocks of generated code!
  28.     //}}AFX_MSG_MAP
  29.     // Standard file based document commands
  30.     ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
  31.     ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
  32. END_MESSAGE_MAP()
  33.  
  34. /////////////////////////////////////////////////////////////////////////////
  35. // CSimplePlayerMFCApp construction
  36.  
  37. CSimplePlayerMFCApp::CSimplePlayerMFCApp()
  38. {
  39.     // TODO: add construction code here,
  40.     // Place all significant initialization in InitInstance
  41. }
  42.  
  43. /////////////////////////////////////////////////////////////////////////////
  44. // The one and only CSimplePlayerMFCApp object
  45.  
  46. CSimplePlayerMFCApp theApp;
  47.  
  48. /////////////////////////////////////////////////////////////////////////////
  49. // CSimplePlayerMFCApp initialization
  50.  
  51. BOOL CSimplePlayerMFCApp::InitInstance()
  52. {
  53.     // Standard initialization
  54.     // If you are not using these features and wish to reduce the size
  55.     //  of your final executable, you should remove from the following
  56.     //  the specific initialization routines you do not need.
  57.  
  58.     // Initialize QTML and QuickTime
  59.     InitializeQTML(0);
  60.     EnterMovies();
  61.  
  62. #ifdef _AFXDLL
  63.     Enable3dControls();            // Call this when using MFC in a shared DLL
  64. #else
  65.     Enable3dControlsStatic();    // Call this when linking to MFC statically
  66. #endif
  67.  
  68.     LoadStdProfileSettings(0);  // Load standard INI file options (including MRU)
  69.  
  70.     // Register the application's document templates.  Document templates
  71.     //  serve as the connection between documents, frame windows and views.
  72.  
  73.     CSingleDocTemplate* pDocTemplate;
  74.     pDocTemplate = new CSingleDocTemplate(
  75.         IDR_MAINFRAME,
  76.         RUNTIME_CLASS(CSimplePlayerMFCDoc),
  77.         RUNTIME_CLASS(CMainFrame),       // main SDI frame window
  78.         RUNTIME_CLASS(CSimplePlayerMFCView));
  79.     AddDocTemplate(pDocTemplate);
  80.  
  81.     // Parse command line for standard shell commands, DDE, file open
  82.     CCommandLineInfo cmdInfo;
  83.     ParseCommandLine(cmdInfo);
  84.  
  85.     // Dispatch commands specified on the command line
  86.     if (!ProcessShellCommand(cmdInfo))
  87.         return FALSE;
  88.  
  89.     return TRUE;
  90. }
  91.  
  92. /////////////////////////////////////////////////////////////////////////////
  93. // CSimplePlayerMFCApp commands
  94.  
  95. int CSimplePlayerMFCApp::ExitInstance() 
  96. {
  97.     // Exit QuickTime and terminate QTML
  98.     ExitMovies();
  99.     TerminateQTML();
  100.     return CWinApp::ExitInstance();
  101. }
  102.  
  103.  
  104. /////////////////////////////////////////////////////////////////////////////
  105. // CAboutDlg dialog used for App About
  106.  
  107. class CAboutDlg : public CDialog
  108. {
  109. public:
  110.     CAboutDlg();
  111.  
  112. // Dialog Data
  113.     //{{AFX_DATA(CAboutDlg)
  114.     enum { IDD = IDD_ABOUTBOX };
  115.     //}}AFX_DATA
  116.  
  117.     // ClassWizard generated virtual function overrides
  118.     //{{AFX_VIRTUAL(CAboutDlg)
  119.     protected:
  120.     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  121.     //}}AFX_VIRTUAL
  122.  
  123. // Implementation
  124. protected:
  125.     //{{AFX_MSG(CAboutDlg)
  126.         // No message handlers
  127.     //}}AFX_MSG
  128.     DECLARE_MESSAGE_MAP()
  129. };
  130.  
  131. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  132. {
  133.     //{{AFX_DATA_INIT(CAboutDlg)
  134.     //}}AFX_DATA_INIT
  135. }
  136.  
  137. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  138. {
  139.     CDialog::DoDataExchange(pDX);
  140.     //{{AFX_DATA_MAP(CAboutDlg)
  141.     //}}AFX_DATA_MAP
  142. }
  143.  
  144. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  145.     //{{AFX_MSG_MAP(CAboutDlg)
  146.         // No message handlers
  147.     //}}AFX_MSG_MAP
  148. END_MESSAGE_MAP()
  149.  
  150. // App command to run the dialog
  151. void CSimplePlayerMFCApp::OnAppAbout()
  152. {
  153.     CAboutDlg aboutDlg;
  154.     aboutDlg.DoModal();
  155. }
  156.  
  157.  
  158.